<template>
  <div>
    <h1>{{ title }}</h1>
    <button @click="changeTitle">Toggle</button>
  </div>
</template>

<script>
export default {
  props: {
    title: String,
  },
  methods: {
    changeTitle() {
      this.$emit('update-title', this.title === 'hello' ? 'world' : 'hello')
    }
  }
}
</script>
